package org.batatasframework.support.database.sql.where;

import java.util.List;

import org.batatasframework.support.database.LogicSymbol;
import org.batatasframework.support.database.metadatas.FieldMetadata;
import org.batatasframework.support.database.sql.FieldFragment;
import org.batatasframework.support.database.sql.QueryParameter;
import org.batatasframework.support.database.sql.TableInstance;

import cn.bonoon.kernel.util.Opt;

/**
 * 无参数的查询条件
 * @author jackson
 *
 */
public class ZeroQueryFragmentDefault extends FieldFragment implements ZeroQueryFragment{

	protected Opt opt;
	
	public ZeroQueryFragmentDefault(TableInstance tableAlias, FieldMetadata fieldMetadata, Opt opt) {
		super(tableAlias, fieldMetadata);
		this.opt = opt;
	}

	@Override
	public void parse(LogicSymbol logic, StringBuilder sql, List<QueryParameter> paramenters) throws Exception {
		sql.append(logic.getValue()).append(columnName).append(opt.getSimpleOperator());
	}

	@Override
	public void reset(Opt opt) {
		this.opt = opt;
	}

}
